package com.start.shop.modules.service.impl;

import java.math.BigDecimal;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.start.shop.common.constant.MsgObject;
import com.start.shop.modules.repository.entity.Order;
import com.start.shop.modules.service.IOrderService;
import com.start.shop.modules.service.IPayNotify;
import com.start.shop.modules.service.IPayService;

@Service
public class PayServiceImpl implements IPayService {

	@Autowired
	IOrderService orderService;
	
	@Autowired
	IPayNotify payNotify;
	
	/**
	 * 支付订单
	 */
	@Override
	@Transactional
	public void pay(int userId, String orderNo, String payType, String passWord ) {
		//订单变更为支付中
		orderService.orderPayCheck(userId, orderNo);

		//查询可以支付的订单
		Order order = orderService.getOrderByOrderNo(userId, orderNo);
		
		//通知支付成功
		payNotify.pointPayNotify(orderNo, userId, "000000001");
		
		//根据payType进行支付
//		if (SysConstants.PAY_TYPE_POINT.equals(payType)) {
//			//扣除积分 支付大于0时
//			if (order.getActualAmt().compareTo(new BigDecimal(0)) >0) {
//				RecordAccountVo recordAccount = acctService.consume(order.getOrderChannel(), custId, order.getActualAmt());
//				//积分成功回调处理
//				payNotify.pointPayNotify(orderNo, custId, recordAccount.getFundsId());
//			}
//		}
	}




}
